//
//  ServerListViewCell.m
//  魔兽大数据
//
//  Created by 王右 on 2017/11/27.
//  Copyright © 2017年 王右. All rights reserved.
//

#import "ServerListViewCell.h"
#import "ServerModel.h"
#import "BigDataHeader.h"

@interface ServerListViewCell()
//排名
@property (weak, nonatomic) IBOutlet UILabel *rankLabel;
//服务器名称
@property (weak, nonatomic) IBOutlet UILabel *serverNameLabel;
//服务器类型
@property (weak, nonatomic) IBOutlet UILabel *serverTypeLabel;
//拍卖总数
@property (weak, nonatomic) IBOutlet UILabel *autionCountLabel;
//物品种类总数
@property (weak, nonatomic) IBOutlet UILabel *itemCountLabel;
//卖家总数
@property (weak, nonatomic) IBOutlet UILabel *sellerCountLabel;
//更新间隔
@property (weak, nonatomic) IBOutlet UILabel *updateIntervalLabel;
//更新时间
@property (weak, nonatomic) IBOutlet UILabel *updateTimeLabel;
@property (weak, nonatomic) IBOutlet UILabel *myHomeServerLabel;

@end


@implementation ServerListViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    _myHomeServerLabel.layer.cornerRadius = 3;
    _myHomeServerLabel.layer.borderColor = _myHomeServerLabel.textColor.CGColor;
    _myHomeServerLabel.layer.borderWidth = .5;
}

- (void)setModel:(ServerModel *)model rank:(NSInteger)rank{
    _rankLabel.text = [NSString stringWithFormat:@"%@",@(rank+1)];
    _serverNameLabel.text = model.targetServerName;
    _serverTypeLabel.text = model.type;
    _autionCountLabel.text = [NSString stringWithFormat:@"拍卖总数:%@",model.auctionQuantity];
    _itemCountLabel.text = [NSString stringWithFormat:@"物品种类:%@",model.itemQuantity];
    _sellerCountLabel.text = [NSString stringWithFormat:@"卖家总数:%@",model.ownerQuantity];
    _updateIntervalLabel.text = [NSString stringWithFormat:@"更新间隔:%@",[model.interval returnTimeStringMin]];
    _updateTimeLabel.text = [NSString stringWithFormat:@"更新时间%@",[model.lastModified retureTimeStringWithFormate:@"MM-dd HH:mm" multiple:1000]];
    
    ServerModel *myModel = [[CCCache defaultManager] objectForKey:@"myHomeServer"];
    
    if ([myModel.serverID isEqualToString:model.serverID]) {
        _myHomeServerLabel.hidden = NO;
    }else{
        _myHomeServerLabel.hidden = YES;
    }
    
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
